/* 用户的增删改查 */
const router = require("koa-router")();
(DB = require("../../module/db.js")), (tools = require("../../module/tools"));

router.get("/", async ctx => {
  var result = await DB.find("article", {});
  await ctx.render("admin/article/index", {
    list: result
  });
  
});
router.get("/add", async ctx => {
  //获取一级分类
  var result = await DB.find("article", { pid: "0" });
  await ctx.render("admin/article/add", {
    catelist: result
  });
});

module.exports = router.routes();
